<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改题目')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-question-edit" th:object="${question}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">题库分类：</label>
                    <div class="col-sm-9">
                        <select name="typeId" class="form-control" th:field="*{typeId}" required>
                            <option value="">请选择</option>
                            <option th:each="type:${typeList}" th:text="${type.name}" th:value="${type.id}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">类型：</label>
                    <div class="col-sm-9">
                        <select name="questionType" class="form-control m-b" th:with="type=${@dict.getType('tb_question_type')}" required th:field="*{questionType}">
                            <option value="">请选择</option>
                            <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-1 control-label">题目：</label>
                    <div class="col-sm-10">
                        <textarea name="title" class="form-control" rows="3" th:field="*{title}"  required></textarea>
                    </div>
                </div>
            </div>
        </div>
        <h3 style="color:#6379bb;margin:8px 10px 20px 70px;">选项:</h3>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">A：</label>
                    <div class="col-sm-9">
                        <input name="answerA" class="form-control" type="text" th:field="*{answerA}" >
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">B：</label>
                    <div class="col-sm-9">
                        <input name="answerB" class="form-control" type="text" th:field="*{answerB}" >
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">C：</label>
                    <div class="col-sm-9">
                        <input name="answerC" class="form-control" type="text" th:field="*{answerC}">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">D：</label>
                    <div class="col-sm-9">
                        <input name="answerD" class="form-control" type="text" th:field="*{answerD}">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-1 control-label">答案：</label>
                    <div class="col-sm-10">
                        <input name="answer" class="form-control" th:field="*{answer}" required>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-1 control-label">解析：</label>
                    <div class="col-sm-10">
                        <textarea name="introduce" class="form-control" rows="8" th:field="*{introduce}"></textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-2 control-label">分数：</label>
                    <div class="col-sm-8">
                        <input name="score" class="form-control" type="number" th:field="*{score}" required>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
    var prefix = ctx + "module/question";
    $("#form-question-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-question-edit').serialize());
        }
    }
</script>
</body>
</html>